package cn.bellychang.sword.finger.offer.question051;

/**
 * @author ChangLiang
 * @date 2021/2/19
 */
public class Solution3 {

    public int reversePairs(int[] nums) {

        int result = 0;

        if (nums.length == 0 || nums.length == 1) {
            return 0;
        }
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i+1; j < nums.length; j++) {
                if (nums[i] > nums[j]) {
                    result++;
                }
            }
        }
        return result;
    }
}
